// strcat模拟实现

#include <iostream>
#include <cstring>
#include <assert.h>

char *strcat_self(char *destination, const char *source)
{
    char *start = destination;
    while (*start != '\0')
    {
        ++start;
    }
    while (*start++ = *source++)
    {
        ;
    }
    return destination;
}

void test1()
{
    char str1[] = "math ";
    char str2[] = "easy";
    printf("%s\n",strcat_self(str1, str2));
}

void test2()
{
    char str[] = "hello";
    strcat_self(str, str);
}

int main()
{   
    test1();
    // test2(); // 死循环
    return 0;
}